class Loading {
    constructor() {
        this.loadingDiv = null;
        this.process = null;
        this.init();
    }
    init() {
        let lt = document.getElementsByClassName('loadingTop');
        for (let i = 0;i < lt.length;i++) {
            lt[0].remove();
        }
        let html = `<div class="scene">
  <div class="objects">
    <div class="square"></div>
    <div class="circle"></div>
    <div class="triangle"></div>
  </div>
  <div class="wizard">
    <div class="body"></div>
    <div class="right-arm">
      <div class="right-hand"></div>
    </div>
    <div class="left-arm">
      <div class="left-hand"></div>
    </div>
    <div class="head">
      <div class="beard"></div>
      <div class="face">
        <div class="adds"></div>
      </div>
      <div class="hat">
        <div class="hat-of-the-hat"></div>
        <div class="four-point-star --first"></div>
        <div class="four-point-star --second"></div>
        <div class="four-point-star --third"></div>
      </div>
    </div>
  </div>
</div>
<div class="progress"><div style="" class="progress-text"></div></div>`;
        this.loadingDiv = document.createElement('div');
        this.loadingDiv.classList.add('loadingTop');
        this.loadingDiv.innerHTML = html;
        document.body.append(this.loadingDiv);
        this.process = document.getElementsByClassName('progress-text')[0];
    }
    setLoadingText(text) {
        if (!this.process.parentElement) {
            this.process = document.getElementsByClassName('progress-text')[0];
        }
        this.process.innerText = text;
    }
    hide() {
        let $this = this;
        this.loadingDiv.classList.add('loadingTop-hide');
        setTimeout(() => {
            // debugger
            if (!$this.loadingDiv.parentElement) {
                $this.loadingDiv = $('.loadingTop')[0];
            }
            $this.loadingDiv.style.display = 'none';
        },1000);
    }
    show() {
        let $this = this;
        this.loadingDiv.classList.remove('loadingTop-hide');
        setTimeout(() => {
            if (!$this.loadingDiv.parentElement) {
                $this.loadingDiv = $('.loadingTop')[0];
            }
            $this.loadingDiv.style.display = 'flex';
        },200);
    }
}
